home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.2_patches / patchSG0000226 / patchSG0000226.idb / usr / include / sys / param.h.z / param.h
C/C++ Source or Header  |  1995-03-10  |  9KB  |  320 lines

  1. /*    Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. /*
  11.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12.  *         PROPRIETARY NOTICE (Combined)
  13.  * 
  14.  * This source code is unpublished proprietary information
  15.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  16.  * In addition, portions of such source code were derived from Berkeley
  17.  * 4.3 BSD under license from the Regents of the University of
  18.  * California.
  19.  * 
  20.  * 
  21.  * 
  22.  *         Copyright Notice 
  23.  * 
  24.  * Notice of copyright on this source code product does not indicate 
  25.  * publication.
  26.  * 
  27.  *     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  28.  *     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  29.  *               All rights reserved.
  30.  *  
  31.  */
  32.  
  33. #ifndef _SYS_PARAM_H
  34. #define _SYS_PARAM_H
  35.  
  36. #include <sys/types.h> 
  37. #include <sys/signal.h>     /* BSD/IRIX4 compat */
  38.  
  39. #ifndef    _PAGESZ            /* for backward compatibility    */
  40. #define    _PAGESZ    4096        /* with old user programs    */
  41. #endif                /* and stand-alone        */
  42.  
  43. /*
  44.  * Fundamental variables; don't change too often.
  45.  */
  46.  
  47. /* POSIX version number, returned by sysconf() system call */
  48. #ifndef _POSIX_VERSION
  49. #define _POSIX_VERSION    199009L
  50. #endif
  51.  
  52. #ifndef _POSIX_VDISABLE
  53. #define _POSIX_VDISABLE 0 /* Disable special character functions */
  54. #endif
  55.  
  56. #ifndef MAX_INPUT
  57. #define MAX_INPUT 512     /* Maximum bytes stored in the input queue */
  58. #endif
  59.  
  60. #ifndef MAX_CANON
  61. #define MAX_CANON 256     /* Maximum bytes in a line for canoical processing */
  62. #endif
  63.  
  64. #define UID_NOBODY    60001    /* user ID no body */
  65. #define GID_NOBODY    UID_NOBODY
  66.  
  67. #define UID_NOACCESS    60002    /* user ID no access */
  68.  
  69. #define    MAXPID    30000        /* max process id */
  70. #define    MAXUID    60002        /* max user id */
  71. #define    MAXLINK    30000        /* max links */
  72.  
  73. #define    SSIZE    1        /* initial stack size (*NBPP bytes) */
  74. #define    SINCR    1        /* increment of stack (*NBPP bytes) */
  75.  
  76. #if    _PAGESZ == 4096
  77. #define    USIZE    2        /* size of user block (*NBPP bytes) */
  78. #define    EXTUSIZE    1    /* size of ustk extension (*NBPP bytes) */
  79. #define    UPGIDX    0
  80. #define KSTKIDX    1
  81. #define KSTEIDX    2        /* Kernel stack extension index */
  82. #else
  83. #define    USIZE    1        /* size of user block (*NBPP bytes) */
  84. #define    UPGIDX    0
  85. #define KSTKIDX    0
  86. #define    EXTUSIZE    0    /* size of ustk extension (*NBPP bytes) */
  87. #endif    /* _PAGESZ == 4096 */
  88.  
  89. #define    CANBSIZ    256        /* max size of typewriter line    */
  90. #define    HZ    100        /* 100 ticks/second of the clock */
  91. #define TICK    10000000    /* nanoseconds per tick */
  92.  
  93. #define NOFILE    20        /* this define is here for    */
  94.                 /* compatibility purposes only    */
  95.                 /* and will be removed in a    */
  96.                 /* later release        */
  97.  
  98. /*
  99.  * These define the maximum and minimum allowable values of the
  100.  * configurable parameter NGROUPS_MAX.
  101.  */
  102. #define    NGROUPS_UMIN    0
  103. #define    NGROUPS_UMAX    32
  104.  
  105. /* 
  106.  * NGROUPS must not be set greater than NGROUPS_MAX in master.d/kernel.
  107.  * Compilation will not succeed in that case.
  108.  */
  109. #define NGROUPS        16    /* max # groups process may be in */
  110.  
  111. /*
  112.  * Priorities.  Should not be altered too much.
  113.  */
  114.  
  115. #define    PMASK    0177
  116. #define    PCATCH    0400
  117. #define    PRECALC    01000
  118. #define    PNOSTOP    02000
  119. #define    PSWP    0
  120. #define    PINOD    10
  121. #define    PSNDD    PINOD
  122. #define    PRIBIO    20
  123. #define    PZERO    25
  124. #define PMEM    0
  125. #ifndef NZERO
  126. #define    NZERO    20
  127. #endif
  128. #define    PPIPE    26
  129. #define    PVFS    27
  130. #define    PWAIT    30
  131. #define    PSLEP    39
  132. #define    PUSER    60
  133. #define    PIDLE    255
  134.  
  135. /*
  136.  * fundamental constants of the implementation--
  137.  * cannot be changed easily
  138.  *
  139.  * On the MIPS CPU a click is a page (4K), a segment is what a click can
  140.  * map (i.e. a page of ptes or 4K/sizeof(pte) * 4K = 4 meg (for 4 byte ptes))
  141.  */
  142.  
  143. #define NBPS    (NCPS*NBPC)    /* Number of bytes per segment */
  144. #define    NBPW    sizeof(int)    /* number of bytes in an integer */
  145. #define    NCPS    (NBPC/(sizeof(void *)))    /* Number of clicks per segment */
  146.  
  147. #define    IO_NBPC        4096    /* Number of bytes per click for DMA purposes */
  148. #define    IO_BPCSHIFT    12    /* LOG2(IO_NBPC) if exact */
  149.  
  150. #define    MIN_NBPC    4096    /* Minimum number of bytes per click */
  151. #define    MIN_BPCSHIFT    12    /* LOG2(MIN_NBPC) if exact */
  152. #define MIN_CPSSHIFT    10    /* LOG2(MIN_NCPS) if exact */
  153.  
  154. #define    NBPC        _PAGESZ    /* Number of bytes per click */
  155.  
  156. #if    NBPC == 4096
  157. #define    BPCSHIFT    12    /* LOG2(NBPC) if exact */
  158. #define CPSSHIFT    10    /* LOG2(NCPS) if exact */
  159. #endif
  160. #if    NBPC == 16384
  161. #define    BPCSHIFT    14    /* LOG2(NBPC) if exact */
  162. #define CPSSHIFT    12    /* LOG2(NCPS) if exact */
  163. #endif
  164. #if    NBPC == 65536
  165. #define    BPCSHIFT    16    /* LOG2(NBPC) if exact */
  166. #define CPSSHIFT    14    /* LOG2(NCPS) if exact */
  167. #endif
  168.  
  169. #ifndef NULL
  170. #define    NULL    0
  171. #endif
  172. #define    CMASK    022        /* default mask for file creation */
  173. #define    CDLIMIT    0x7fffffff    /* default max write address */
  174. #define    NODEV    (dev_t)(-1)
  175. #define NOPAGE    ((unsigned int)-1)
  176.  
  177. /*
  178.  * XXX These should be expunged, and BBSHIFT should be defined as 9.
  179.  */
  180. #define    NBPSCTR        512    /* Bytes per disk sector.    */
  181. #define SCTRSHFT    9    /* Shift for BPSECT.        */
  182. #define    UBSIZE        512    /* unix block size.        */
  183.  
  184. #define    UMODE    3        /* current Xlevel == user */
  185. /* in mips the psw is the status register */
  186. #define    BASEPRI(psw)    (((psw) & SR_IMASK) == SR_IMASK)
  187. #if R3000
  188. #define    USERMODE(psw)    (((psw) & SR_KUP) == SR_KUP)
  189. #endif
  190. #if R4000 || TFP
  191. #define    USERMODE(psw)    (((psw) & SR_KSU_MSK) == SR_KSU_USR)
  192. #endif
  193.  
  194. #ifdef MIPSEB
  195. #define    lobyte(X)    (((unsigned char *)&X)[1])
  196. #define    hibyte(X)    (((unsigned char *)&X)[0])
  197. #define    loword(X)    (((ushort *)&X)[1])
  198. #define    hiword(X)    (((ushort *)&X)[0])
  199. #else
  200. #define    lobyte(X)    (((unsigned char *)&X)[0])
  201. #define    hibyte(X)    (((unsigned char *)&X)[1])
  202. #define    loword(X)    (((ushort *)&X)[0])
  203. #define    hiword(X)    (((ushort *)&X)[1])
  204. #endif
  205.  
  206.  
  207. #define    MAXSUSE    255
  208.  
  209. /* REMOTE -- whether machine is primary, secondary, or regular */
  210. #define SYSNAME 9        /* # chars in system name */
  211. #define PREMOTE 39
  212.  
  213. /*
  214.  * MAXPATHLEN defines the longest permissible path length,
  215.  * including the terminating null, after expanding symbolic links.
  216.  * MAXSYMLINKS defines the maximum number of symbolic links
  217.  * that may be expanded in a path name. It should be set high
  218.  * enough to allow all legitimate uses, but halt infinite loops
  219.  * reasonably quickly.
  220.  * MAXNAMELEN is the length (including the terminating null) of
  221.  * the longest permissible file (component) name.
  222.  */
  223. #define    MAXPATHLEN    1024
  224. #define    MAXSYMLINKS    30
  225. #define    MAXNAMELEN    256
  226.  
  227. #ifndef NADDR
  228. #define NADDR 13
  229. #endif
  230.  
  231. /*
  232.  * The following are defined to be the same as
  233.  * defined in /usr/include/limits.h.  They are
  234.  * needed for pipe and FIFO compatibility.
  235.  */
  236. #ifndef PIPE_BUF    /* max # bytes atomic in write to a pipe */
  237. #define PIPE_BUF    10240
  238. #endif    /* PIPE_BUF */
  239.  
  240. #ifndef PIPE_MAX    /* max # bytes written to a pipe in a write */
  241. #define PIPE_MAX    10240
  242. #endif    /* PIPE_MAX */
  243.  
  244. #ifndef    NBBY
  245. #define    NBBY    8    /* number of bits per byte */
  246. #endif    /* NBBY */
  247.  
  248. /*
  249.  * Block I/O parameterization.  A basic block (BB) is the lowest size of
  250.  * filesystem allocation, and must == NBPSCTR.  Length units given to bio
  251.  * routines are in BB's.
  252.  */
  253. #define    BBSHIFT        9
  254. #define    BBSIZE        (1<<BBSHIFT)
  255. #define    BBMASK        (BBSIZE-1)
  256. #define    BTOBB(bytes)    (((unsigned long)(bytes) + BBSIZE - 1) >> BBSHIFT)
  257. #define    BTOBBT(bytes)    ((unsigned long)(bytes) >> BBSHIFT)
  258. #define    BBTOB(bbs)    ((bbs) << BBSHIFT)
  259.  
  260. #define SEEKLIMIT    0x7fffffff
  261. #define BBSEEKLIMIT    BTOBBT(SEEKLIMIT)
  262.  
  263. /*
  264.  * File system parameters and macros.
  265.  *
  266.  * The file system is made out of blocks of at most MAXBSIZE units,
  267.  * with smaller units (fragments) only in the last direct block.
  268.  * MAXBSIZE primarily determines the size of buffers in the buffer
  269.  * pool. It may be made larger without any effect on existing
  270.  * file systems; however making it smaller make make some file
  271.  * systems unmountable.
  272.  *
  273.  * Note that the blocked devices are assumed to have DEV_BSIZE
  274.  * "sectors" and that fragments must be some multiple of this size.
  275.  */
  276. #define    MAXBSIZE    8192
  277. #define    DEV_BSIZE    BBSIZE
  278. #define    DEV_BSHIFT    BBSHIFT        /* log2(DEV_BSIZE) */
  279.  
  280. #define    btodb(bytes)             /* calculates (bytes / DEV_BSIZE) */ \
  281.     ((unsigned)(bytes) >> DEV_BSHIFT)
  282. #define    dbtob(db)            /* calculates (db * DEV_BSIZE) */ \
  283.     ((unsigned)(db) << DEV_BSHIFT)
  284.  
  285. /*
  286.  * Maximum size of hostname and domainname recognized and stored in the
  287.  * kernel by sethostname and setdomainname
  288.  */
  289. #define MAXHOSTNAMELEN 64
  290.  
  291. /*
  292.  * Macros for fast min/max.
  293.  */
  294. #define MIN(a,b) (((a)<(b))?(a):(b))
  295. #define MAX(a,b) (((a)>(b))?(a):(b))
  296.  
  297. /*
  298.  * Macros for counting and rounding.
  299.  */
  300. #ifndef howmany
  301. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  302. #endif
  303. #define    roundup(x, y)    ((((x)+((y)-1))/(y))*(y))
  304.  
  305. #if defined(_KERNEL) || defined(_STANDALONE)
  306. /*
  307.  * DELAY(n) should be n microseconds, roughly. 
  308.  */
  309. #define DELAY(n)    us_delay(n)
  310. /* to guarentee delay between writes, use DELAYBUS */
  311. #define DELAYBUS(n)    us_delaybus(n)
  312.  
  313. /* timeout call with this tick results in immediate timepoke() 
  314.  */
  315. #define TIMEPOKE_NOW    -100
  316. extern int ngroups_max;        /* master.d/kernel */
  317. #endif /* _KERNEL || _STANDALONE */
  318.  
  319. #endif    /* _SYS_PARAM_H */
  320.